using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using Microsoft.Xna.Framework;
using CreamXStudio;
using CreamXStudio.Classes;
using CreamX.Framework.Game;
using CreamX.Framework.SceneGraph;


namespace CreamXStudio.Screens
{
    public partial class AnimationEditor : EditorControlBase
    {
        public CreamXSceneData _data;
        public AnimationEditor()
        {
            if(SessionData.Instance.CurrentScene!=null &&
                SessionData.Instance.CurrentScene.SceneData!=null)
                _data = SessionData.Instance.CurrentScene.SceneData;

            InitializeComponent();
        }
        internal override void SetData(object data)
        {
           // SelectedObject= (CreamXObject)data;
            RefreshAnimations();
            base.SetData(data);
        }

        private void RefreshAnimations()
        {
            cboAnimations.Items.Clear();
            cboAnimations.Items.Add("<New>");
            foreach (AnimationInfo an in _data.AnimationData)
            {
                cboAnimations.Items.Add(an.Name);
            }
        }

        private void cboAnimations_SelectedIndexChanged(object sender, EventArgs e)
        {
            AnimationInfo an=_data.GetAnimation(cboAnimations.Text);
            propertyGrid1.SelectedObject = an;
        }

    }
}
